package com.hezhou.oauth2.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hezhou.oauth2.web.entities.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * ---------------------------
 * (SysUserMapper) 系统用户的数据映射
 * ---------------------------
 *
 * @Author: [hezhou]
 * @Date: 2020/3/6
 * @Version: [1.0.1]
 * ---------------------------
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    IPage<SysUser> findPageByCondition(Page<SysUser> page, @Param("sysUser") SysUser sysUser);

    /**
     * 删除用户角色
     * @param userId
     * @return
     */
    Boolean deleteUserRoleByUserId(@Param("userId") Long userId);

    SysUser selectOneUser(@Param("userName") String userName);

    /**
     * 批量新增用户角色
     * @param roleIds
     * @return
     */
    Boolean batchInsertUserRole(@Param("userId") Long userId, @Param("ids") List<Long> roleIds);
}
